﻿using System;
using BlockLogic.Impl.Blocks.Checker.Enum;

namespace BlockLogic.Impl.Blocks.Checker.Strategy
{
    class ExponentialChecking : CheckingStrategy
    {
        public double Lambda { get; set; }

        public ExponentialChecking()
        {
            _type = CheckerType.EXPONENTIAL;
            Lambda = 1;
        }

        public ExponentialChecking(double lambda)
        {
            _type = CheckerType.EXPONENTIAL;
            Lambda = lambda;
        }

        protected override double DistributionFunctionValue(double x)
        {
            if (x < 0)
            {
                return 0;
            }
            return 1 - Math.Exp(-Lambda * x);
        }
    }
}
